package com.itheima.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.itheima.dao.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = IHelloService.class)
/**
 *  No provider available from registry 127.0.0.1:2181
 *  1、 <dubbo:annotation package="com.itheima.service"></dubbo:annotation> 是否配置错误
 *  2、zookeeper没有开
 *  3、@Service(interfaceClass = IHelloService.class)没有写interfaceClass
 *  4、health_service启动没有报错
 *  5、修改当前网络的活跃度
 *  6、消费端启动检查需要
 *  7、@Reference写错了要用dubbo
 */
@Transactional
public class IHelloServiceImpl implements IHelloService {

    @Autowired
    TestMapper testMapper;


    @Override
    public String say(String name) {
        String s = JSON.toJSONString(testMapper.findAll());
        return "hello " + name + "-" + s;
    }
}
